package com.chengcang.api.modules.sys.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 * 
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2023-01-10
 */
@Data
@TableName("sys_product")
public class SysProductEntity {

    @ApiModelProperty(value = "")
    private Long id;

    private Long productTypeId;

    private String name;

    private String code;

    private String spec;

    private String picUrl;

    private Integer status;

    @TableField(exist = false)
    private String statusDesc;

    private Integer sort;

    private String remark;

    @TableField(fill = FieldFill.INSERT)
    private Integer deleted;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long creator;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date createDate;

    @TableField(fill = FieldFill.UPDATE)
    private Long updater;

    @TableField(fill = FieldFill.UPDATE)
    private Date updateDate;

    public void setStatus(Integer status){
        this.status = status;
        if(status != null)  setStatusDesc(status  == 0 ? "启用": "禁用");
    }
}